﻿<Window
     xmlns:XbdSoftView="clr-namespace:XbdSoft.WPFVersion.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:effect="clr-namespace:XbdSoft.WPFVersion.Effect"
        xmlns:WPFVersion ="clr-namespace:XbdSoft.WPFVersion"
        xmlns:WPFVersionControls ="clr-namespace:XbdSoft.WPFVersion.UserControls"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:interopControl="clr-namespace:XbdSoft.InteropControls;assembly=XbdSoft.InteropControls"
        mc:Ignorable="d" x:Class="XbdSoft.WPFVersion.Shell"   Name="Root" FontSize="12"   
        Title="小布叮软件" Height="500" Width="744" WindowStyle="None"   WindowStartupLocation="CenterScreen"
        Loaded="Window_Loaded" Icon="/Images/favicon.ico" Background="Transparent" Opacity="1">
 
    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="12"></Setter>
        </Style>
        <Style TargetType="{x:Type TextBlock}" x:Key="advertisement"> 
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="TextDecorations" Value="Underline"/>
                    <Setter Property="Cursor" Value="Hand"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="imageButton" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border BorderThickness="1,0,1,0" VerticalAlignment="Top" BorderBrush="Gray" Height="15" Background="{TemplateBinding Background}"> 
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>  
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="FontSize" Value="13"></Setter>
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                        <GradientStop Color="#FFF3F3F3" Offset="0"/>
                        <GradientStop Color="#FFC0DFEB"/>
                        <GradientStop Color="#FFEFF8FC" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter> 
        </Style>
        <Storyboard x:Key="OnLoaded1">
        	<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="AdvitiseTextBlock">
        		<EasingDoubleKeyFrame KeyTime="0" Value="3"/>
        	</DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>
<Border CornerRadius="4"  Height="Auto" BorderThickness="2" Background="#FFACDDEF" BorderBrush="#FF4C9DC5">

		<Grid Margin="0">
 			<Grid.RowDefinitions>
 				<RowDefinition Height="20"/>
 				<RowDefinition Height="20"/>
 				<RowDefinition Height="*"/>
 				<RowDefinition Height="20"/>	
			</Grid.RowDefinitions> 
            <Border BorderThickness="0" Height="20" MouseLeftButtonDown="DragWindow" BorderBrush="LightGray">            	
                    	<Border.Background>
                    		<LinearGradientBrush EndPoint="0.6,1" StartPoint="0.2,0.2">
                    			<GradientStop Color="#FF489CC5"/>
                    			<GradientStop Color="#FFC2E5F3" Offset="1"/>
                    			<GradientStop Color="#FF85BFDA" Offset="0.277"/>
                    		</LinearGradientBrush>
                    	</Border.Background>
				<Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="28"/>
                        <ColumnDefinition Width="*"/>
						<ColumnDefinition Width="31"/>
						<ColumnDefinition Width="31"/>
					</Grid.ColumnDefinitions>
                    <Image Grid.Column="0" Source="favicon.ico"></Image>
                    <TextBlock Grid.Column="1" Padding="0,2,0,0"  FontWeight="Bold">小布叮软件</TextBlock>
                    <Button Grid.Column="3"  Cursor="Hand" Height="23"  VerticalAlignment="Top" ToolTip="关闭"  BorderThickness="0,0" Style="{StaticResource imageButton}" Click="CloseButton_Click" >
                        <Button.Background>
                            <ImageBrush ImageSource="Images/close.gif"></ImageBrush>
                        </Button.Background>
					</Button>
                    <Button Grid.Column="2"   x:Name="Button"  Cursor="Hand" Width="31" Height="23" VerticalContentAlignment="Top" ToolTip="最小化"  BorderThickness="0"  Click="MinButton_Click" Style="{StaticResource imageButton}" HorizontalAlignment="Right" d:LayoutOverrides="Width" RenderTransformOrigin="1.71,0.261">
	                	<Button.Background>
                            <ImageBrush ImageSource="Images/min.png"></ImageBrush>
	                	</Button.Background>
	                </Button>					
				</Grid>
			</Border>
			<Grid Grid.Row="1" VerticalAlignment="Center">
				<Grid.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF68D5F9" Offset="0"/>
						<GradientStop Color="#FFB0E2F1" Offset="1"/>
					</LinearGradientBrush>
				</Grid.Background>
				<TextBlock x:Name="WelComeTextBlock" HorizontalAlignment="Left" Margin="10,0,0,-3.837" TextWrapping="Wrap" d:LayoutOverrides="Height" Text="您好" 
                            VerticalAlignment="Center" RenderTransformOrigin="1.917,0.336" Padding="0,2,0,0"/>
                <Menu Width="200" HorizontalAlignment="Right" FontSize="12" Margin="0,0,257,0" d:LayoutOverrides="Width"
                       VerticalAlignment="Center" Background="Transparent" RenderTransformOrigin="0.73,0.45"> 
                    <MenuItem Header="设置" x:Name="SetupMenuItem" StaysOpenOnClick="True" Click="SetupMenuItem_Click"/>
                    <MenuItem Header="显示试听" x:Name="ShowTryListenMenuItem" StaysOpenOnClick="True" Click="ShowTryListenMenuItem_Click"/>
                </Menu>
				</Grid>
			<TabControl Name="MainTabControl" SelectionChanged="TabControl_SelectionChanged" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="0" VerticalAlignment="Stretch" Panel.ZIndex="1" BorderThickness="0,1,0,0" BorderBrush="#FF489CC5" Background="Transparent"  >
                <TabItem Name="InfoTabItem" Header="焦点"  ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" >
                    <WebBrowser Margin="0"  x:Name="InfoWebBrowser"   LoadCompleted="InfoWebBrowser_LoadCompleted"/>
                </TabItem>
                <TabItem Name="DownloadTabItem" Header="下载"  >
                    <XbdSoftView:DownloadView x:Name="downloadView"  Padding="0" Margin="0" Background="Transparent"></XbdSoftView:DownloadView>
                </TabItem>
                <TabItem Name="RecommendDownloadTabItem" Header="推荐" >
                     <XbdSoftView:RecommendDownloadView  Padding="0" Margin="0" x:Name="recommendDownloadView" Background="Transparent"></XbdSoftView:RecommendDownloadView>
                </TabItem>
                <TabItem Name="SearchTabItem" Header="搜索" >
                    <XbdSoftView:SearchResourceView  Padding="0" Margin="0" x:Name="searchResouceView" Background="Transparent"></XbdSoftView:SearchResourceView>
                </TabItem>
            </TabControl>
			<Border BorderThickness="0" Margin="0,-2,0,0" Grid.Row="3" CornerRadius="3" BorderBrush="LightGray">
				<Border.Background>
					<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
						<GradientStop Color="#FF4ECB99"/>
						<GradientStop Color="#FFDAEDF6" Offset="1"/>
						<GradientStop Color="#FF2B7ECA" Offset="1"/>
						<GradientStop Color="#FFAFE0F3" Offset="0.004"/>
					</LinearGradientBrush>
				</Border.Background>
				<Canvas>
                    <TextBlock  x:Name="AdvitiseTextBlock" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                Canvas.Left="{Binding  ElementName=Root,Path=AdviticeLeft,Mode=OneWay}" Style="{StaticResource advertisement}"   
                                Margin="0" MouseLeftButtonDown="AdviticeTextBlock_MouseLeftButtonDown" Padding="5,3,0,0" >
						<Run Language="zh-cn" Text="小布叮软件"/>	
                        
					</TextBlock>
				</Canvas>
				
			</Border>

            <WindowsFormsHost Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Right"  Margin="1" Panel.ZIndex="10000" x:Name="winMediaPlayerHost" Width="150" Height="65"  Visibility="Collapsed">
                <interopControl:WinMediaPlayer x:Name="winMediaPlayer" ></interopControl:WinMediaPlayer>
            </WindowsFormsHost>

            <WPFVersion:NotifyIcon
			x:Name="notifyIcon"
			Text="小布叮软件"
			Icon="Images/favicon.ico"
			BalloonTipText="小布叮软件"
			BalloonTipTitle="小布叮软件"
			BalloonTipIcon="Info"
			MouseDoubleClick="OnNotifyIconDoubleClick">
                <WPFVersion:NotifyIcon.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="设置" Click="OnConfigurationClick" />
                        <MenuItem Header="打开" Click="OnOpenClick" />
                        <MenuItem Header="隐藏" Click="OnHideClick" />
                        <MenuItem Header="退出" Click="OnExitClick" />
                    </ContextMenu>
                </WPFVersion:NotifyIcon.ContextMenu>
            </WPFVersion:NotifyIcon>
             
        </Grid>
	</Border>
</Window>
